<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>集团电商</title>
    <!--common-->
    <link href="__STATIC__/admin/assets/css/bootstrap.css" rel="stylesheet">
    <script src="__STATIC__/admin/assets/js/jquery.js"></script>
</head>
<body class="sticky-header">
<div class="container" style="padding-top: 10px;">
    <div class="main-title">
        <h2>设置来源绑定</h2>
    </div>

    <div id="auth_groups" style="margin: 12px">
        <form class="form-horizontal" action="{:url('setstates')}" method="post">
            <div class="form-group" style="font-weight: bold;">渠道绑定来源</div>
            <div class="form-group">
                {if condition="$qudao.type == 1"}
                    {volist name="origin" id="vo"}
                        {eq name="vo.type" value="1"}
                            <label class="checkbox-inline">
                                <input class="caneditstates" type="checkbox" name="rule[]" value="{$vo.id}">{$vo.title}
                            </label>
                        {/eq}
                    {/volist}
                {else/}
                    {volist name="origin" id="vo"}
                        {eq name="vo.type" value="2"}
                            <label class="checkbox-inline">
                                <input class="caneditstates" type="checkbox" name="rule[]" value="{$vo.id}">{$vo.title}
                            </label>
                        {/eq}
                    {/volist}
                {/if}
            </div>
            <input type="hidden" name="id" value="{$qudao.id}">
            <div style="margin-top: 10px;" class="form-group">
                <button type="submit" class="btn btn-success">确 定</button>
            </div>
        </form>
    </div>

    <!--body wrapper end-->
</div>
<script type="text/javascript">
    $(function(){
        var caneditstates = [{$qudao.rule}];
        $('.caneditstates').each(function(){
            if( $.inArray( parseInt(this.value,10),caneditstates )>-1 ){
                $(this).prop('checked',true);
            }
        });
    });
</script>
</body>
</html>